﻿namespace Maltose.Aliyun.RocketMQ
{
    public class MessageQueueHostSetting
    {

        /// <summary>
        /// AccessKeyId 阿里云身份验证，在阿里云服务器管理控制台创建
        /// </summary>
        public string AccessKey { get; set; }

        /// <summary>
        ///  AccessKeySecret 阿里云身份验证，在阿里云服务器管理控制台创建
        /// </summary>
        public string SecretKey { get; set; }

        /// <summary>
        /// 控制台创建的 Group ID
        /// </summary>
        public string GroupID { get; set; }

        /// <summary>
        /// 控制台创建的 Topic
        /// </summary>
        public string Topic { get; set; }

        /// <summary>
        /// 设置 TCP 接入域名，进入控制台的实例管理页面的“获取接入点信息”区域查看
        /// </summary>
        public string NameSrvAddr { get; set; }


        public ONSFactoryProperty factoryInfo { get; }


        public MessageQueueHostSetting()
        {
            // 配置账号, 从控制台获取设置
            factoryInfo = new ONSFactoryProperty();

            factoryInfo.SetFactoryProperty(ONSFactoryProperty.AccessKey, AccessKey);

            factoryInfo.SetFactoryProperty(ONSFactoryProperty.SecretKey, SecretKey);

            factoryInfo.SetFactoryProperty(ONSFactoryProperty.ProducerId, GroupID);

            factoryInfo.SetFactoryProperty(ONSFactoryProperty.PublishTopics, Topic);

            factoryInfo.SetFactoryProperty(ONSFactoryProperty.NAMESRV_ADDR, NameSrvAddr);

            // 设置日志路径
            //factoryInfo.SetFactoryProperty(ONSFactoryProperty.LogPath, "C://log");
        }
    }
}
